<?php

/*
 * 预报入库数据类
 */
class Application_Model_DbTable_ingstore extends Application_Model_DbTable_DomainObject{
    
        protected $_name = 'uuch_ingstore';	
        
	public function getMapper(){
		return array('id','name','type','shipTypeid','shipType','shipNo','url','remark','createtime','intime','state','userid','problemContent','ckPass');
	}
     
        
        /*
         * 根据用户序号获取当前库存信息
         */
        public  function getByUser($userId,$state,$start,$row){
            
            $db = $this->getAdapter();
            $filter = $db->quoteInto(' userid = ?', $userId);            
            $filter = $db->quoteInto(' state = ?', $state);   
            $rows = $this->fetchAll($filter,'id',$row,$start);
            
            $result = array();
            foreach ($rows as $row){
                array_push($result,$this->convertRowToObject($row));
                    
            }           
            return $result;

        }
        
        public  function getItemCount($user,$status){
            
            if(isset($status)){
                $result = $this->count(array('userid'=>$user,' state'=>$status));
            }
            else{
                $result = $this->count(array('userid'=>$user));
            }            
           
            return $result;
        }
   

}
?>
